package com.zt.base;

//静态导入日期转换方法
import cn.org.rapid_framework.util.DateConvertUtils;

/**
 * BaseEntity
 * 
 * @author zhangzhw
 * @describe 基本实体 返回结果继承的基类 要想将返回结果以xml 根方式返回,需要继承此类
 * 
 */
@SuppressWarnings("serial")
public class BaseEntity implements java.io.Serializable {

	protected static final String DATE_FORMAT = "yyyy-MM-dd";

	protected static final String TIME_FORMAT = "HH:mm:ss";

	protected static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

	protected static final String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.S";

	public static String date2String(java.util.Date date, String dateFormat) {
		return DateConvertUtils.format(date, dateFormat);
	}

	public static <T extends java.util.Date> T string2Date(String dateString,
			String dateFormat, Class<T> targetResultType) {
		return DateConvertUtils.parse(dateString, dateFormat, targetResultType);
	}
}
